/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package player.util;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import player.model.Playlist;

/**
 *
 * @author Andrej
 */
public class PlaylistLoader
{
    public static Playlist loadPlaylist(String filename) throws Exception
    {
        ObjectInputStream stream = new ObjectInputStream(new FileInputStream(filename));
        Playlist playlist = (Playlist)stream.readObject();
        return playlist;
    }

    public static void savePlaylist(Playlist playlist, String filename) throws Exception
    {
        ObjectOutputStream stream = new ObjectOutputStream(new FileOutputStream(filename,true));
        stream.writeObject(playlist);
    }
}
